<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>symbol</title>
</head>
<body>
<script>
const name1 = Symbol('11');
const name2 = Symbol('11');
console.log(name1);
console.log(name2);
console.log(name1 === name2);//false
</script>
<script>
const name11 = Symbol.for('11');
const name22 = Symbol.for('11');
console.log(name11);
console.log(name22);
console.log(name11 === name22);//true
</script>
<script>
const syObject = {};
const sy1 = Symbol();
const sy2 = Symbol();
syObject[sy1] = "kk1";
syObject[sy2] = "kk2";;
console.log(syObject);
console.log(syObject[sy1]);//kk1
for(let key in syObject) {
	console.log(key);//无输出
}
</script>
<script>
const nameAA = Symbol.for('aa');
console.log(Symbol.keyFor(nameAA));//aa
</script>
<script type="text/javascript">
var arr1 = [1,2,3,4];
let iterator = arr1[Symbol.iterator]();
console.log(iterator);
console.log(iterator.next());
console.log(iterator.next());
</script>
</body>
</html>